package com.carreirati.evaluation;

import com.carreirati.evaluation.domain.Settings;
import org.springframework.roo.addon.web.mvc.controller.json.RooWebJson;
import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/settingses")
@Controller
@RooWebScaffold(path = "settingses", formBackingObject = Settings.class)
@RooWebJson(jsonObject = Settings.class)
public class SettingsController {
	
	 @RequestMapping(produces = "text/html")
	    public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
	        
	    	return "redirect:/settingses/1";
	    /*	if (page != null || size != null) {
	            int sizeNo = size == null ? 10 : size.intValue();
	            final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo;
	            uiModel.addAttribute("settingses", Settings.findSettingsEntries(firstResult, sizeNo));
	            float nrOfPages = (float) Settings.countSettingses() / sizeNo;
	            uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
	        } else {
	            uiModel.addAttribute("settingses", Settings.findAllSettingses());
	        }
	        return "settingses/list";*/
	    }
	
}
